import request from "@/utils/request";

/**
 * 保存信息
 * @param {*} data
 * @returns
 */
export function saveMessage(data) {
  return request({
    url: "/duty/info",
    method: "post",
    data: data,
  });
}

/**
 * 续报信息
 * @param {*} data
 * @returns
 */
export function proceedMessage(data) {
  return request({
    url: "/duty/info/renewal",
    method: "post",
    data: data,
  });
}

/**
 * 获取信息列表
 * @param {*} query
 * @returns
 */
export function listMessage(query) {
  return request({
    url: "/duty/info/list",
    method: "get",
    params: query,
  });
}

/**
 * 获取接报信息列表
 * @param {*} query
 * @returns
 */
export function listReceiveMessage(query) {
  return request({
    url: "/duty/info/selectAllInfos",
    method: "get",
    params: query,
  });
}

/**
 * 获取事件信息历史续报版本接口
 * @param {*} query
 * @returns
 */
export function listHistoryMessage(infoId, query) {
  return request({
    url: "/duty/common/resubmit/list/" + infoId,
    method: "get",
    params: query,
  });
}

/**
 * 获取单条信息
 * @param {*} infoId
 * @returns
 */
export function getMessage(infoId) {
  return request({
    url: "/duty/info/" + infoId,
    method: "get",
  });
}

/**
 * 获取历史指定版本信息
 * @param {*} infoId
 * @returns
 */
export function getHistoryMessage(infoId, id) {
  return request({
    url: "/duty/common/resubmit/selectById/" + id + "/" + infoId,
    method: "get",
  });
}

/**
 * 删除信息
 * @param {*} infoId
 * @returns
 */
export function delMessage(infoId) {
  return request({
    url: "/duty/info/" + infoId,
    method: "delete",
  });
}

/**
 * 合并接报信息
 * @param {*} data
 * @returns
 */
export function mergeMessage(data) {
  return request({
    url: "/duty/common/mergeInfos",
    method: "put",
    data: data,
  });
}

/**
 * 修改
 * @param {*} data
 * @returns
 */
export function revampMessage(data) {
  return request({
    url: "/duty/info",
    method: "put",
    data: data,
  });
}

/**
 * 执行
 * @param {*} data
 * @returns
 */
export function goExecute(data) {
  return request({
    url: "/pla/task/updateStatus",
    method: "put",
    data: data,
  });
}

/**
 * 查询任务完成进度
 * @param {*} planId
 * @returns
 */
export function PlanMessage(planId) {
  return request({
    url: "/pla/task/selectAllTasksByPlanId/" + planId,
    method: "get",
  });
}

/**
 * 上报或抄送接口
 * @param {*} data
 * @returns
 */
export function copyInfo(data) {
  return request({
    url: "/duty/common/copyDutyInfo",
    method: "post",
    data: data,
  });
}

/**
 * 将事件设为待处置接口
 * @param {*} data
 * @returns
 */
export function handleInfo(data) {
  return request({
    url: "/hd/handle",
    method: "post",
    data: data,
  });
}

/**
 * 根据处置handleId查询事件
 * @param {*} handleId
 * @returns
 */
export function getInfoByHandleId(handleId) {
  return request({
    url: "/duty/info/getDutyInfoByHandleId/" + handleId,
    method: "get",
  });
}

/**
 * 获取事件数据
 * @returns
 */
export function getEventData(infoId) {
  return request({
    url: "/duty/common/" + infoId,
    method: "get",
  });
}

/**
 * 获取事件数据
 * @param {*} infoId
 * @returns
 */
export function getEventEditData(infoId) {
  return request({
    url: "/duty/common/getReportInfo/" + infoId,
    method: "get",
  });
}

/**
 * 获取事件列表
 * @returns
 */
export function getEventList() {
  return request({
    url: "/duty/common/list",
    method: "get",
  });
}

/**
 * 事件报送接口
 * @param {*} data
 * @returns
 */
export function reportEvent(data) {
  return request({
    url: "/duty/common",
    method: "post",
    data: data,
  });
}

/**
 * 事件续报接口
 * @param {*} data
 * @returns
 */
export function resendEvent(data) {
  return request({
    url: "/duty/common/resubmit",
    method: "post",
    data: data,
  });
}
